]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Don't log error name
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 11 May 2020 23:12:50 +0000 (01:12 +0200)
committerFlorian Müllner <florian.muellner@gmail.com>
Thu, 21 May 2020 21:45:04 +0000 (21:45 +0000)
logExtensionError() currently saves the error message by calling
toString() on the passed error. That's convenient as it allows to
pass a string instead of a "proper" error, but the result isn't
great for the common Error case: Its toString() method prefixes
the message with the error name, which usually is just "Error:".

The plain message is more suitable for displaying it to users,
so use that for Error objects.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2337

js/ui/extensionSystem.js

index 50244d95fc88d8709cfd641a52011c77f0a2235d..f0b8361714efe248d118322f2f4a7a25a62d4cfe 100644 (file)
@@ -260,7 +260,8 @@ var ExtensionManager = class {
         if (!extension)
             return;
 
-        let message = error.toString();
+        const message = error instanceof Error
+            ? error.message : error.toString();
 
         extension.error = message;
         extension.state = ExtensionState.ERROR;